<template>
  <ul class="todo-list" >
    <!-- completed: 完成的类名 -->
    <li :class="{completed:item.isDone}" v-for="(item,index) in list" :key="index">
      <div class="view">
        <input class="toggle" type="checkbox" @change="change1(item.id)" :checked="item.isDone"/>
        <label>{{item.name}}</label>
        <button class="destroy" @click="del(item.id)"></button>
      </div>
    </li>
  </ul>
  
</template>

<script>
export default {
  props:{list:{type:Array,required:true}},
  methods:{
    change1(id) {
     this.$emit('change1',id) 
    },
    del(id) {
      this.$emit('del',id)
    }
  }
}
</script>